<?php
define('IN_SEXMALL', true);

require(dirname(__FILE__) . '/includes/init.php');

/* act操作项的初始化 */
if (empty($_REQUEST['act']))
{
	$_REQUEST['act'] = 'list';
}
else
{
	$_REQUEST['act'] = trim($_REQUEST['act']);
}


/*------------------------------------------------------ */
//-- 列表页面
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'list')
{
	/* 取得过滤条件 */
	$filter = array();

	$memStatus = $mem->getStatus();

	$memStatus['time'] = date("Y-m-d H:i:s", $memStatus['time']);
	$memStatus['bytes'] = round($memStatus['bytes'] / 1024 / 1024, 2) . 'M';
	$memStatus['bytes_read'] = round($memStatus['bytes_read'] / 1024 / 1024, 2) . 'M';
	$memStatus['bytes_written'] = round($memStatus['bytes_written'] / 1024 / 1024, 2) . 'M';
	$memStatus['limit_maxbytes'] = round($memStatus['limit_maxbytes'] / 1024 / 1024, 2) . 'M';

	$memStatus['hit_rate'] = round($memStatus['get_hits'] / $memStatus['cmd_get'], 2) * 100 . '%';
	$memStatus['miss_rate'] = round($memStatus['get_misses'] / $memStatus['cmd_get'], 2) * 100 . '%';

	$smarty->assign('ur_here',       'memcache运行状态');
	$smarty->assign('full_page',  1);
	$smarty->assign('memStatus',  $memStatus);
	$smarty->display('memcache_status.htm');
}
